import request from '@/utils/request'

// 注册
export const register = (data) => {
  return request({
    url: '/api/v1/user/register',
    method: 'post',
    data
  })
}

// 登录
export const login = (data) => {
  return request({
    url: '/api/v1/user/login',
    method: 'post',
    data
  })
}

// 更新用户信息
export const updateUser = (data) => {
  return request({
    url: '/api/v1/user/update',
    method: 'post',
    data
  })
}

// 删除用户
export const deleteUser = (params) => {
  return request({
    url: '/api/v1/user/delete',
    method: 'get',
    params
  })
}

// 查询单个用户
export const findOneUser = (params) => {
  return request({
    url: '/api/v1/user/findOne',
    method: 'get',
    params
  })
}

// 查询所有用户
export const findAllUser = (params) => {
  return request({
    url: '/api/v1/user/findAll',
    method: 'get',
    params
  })
}

// 判断用户名是否存在
export const nameExist = (params) => {
  return request({
    url: '/api/v1/user/name/exist',
    method: 'get',
    params
  })
}

// 重置用户密码
export const resetUserPassword = (data) => {
  return request({
    url: '/api/v1/user/reset/password',
    method: 'post',
    data
  })
}